home *** CD-ROM | disk | FTP | other *** search
- /*
- File: GXEditDoc.h
-
- Contains:
-
- Written by: Barton R. House
-
- Copyright: © 1993 by Apple Computer, Inc., All rights reserved.
-
- */
-
- #ifndef _H_Doc
- #define _H_Doc
-
- #ifndef __PRINTINGMANAGER__
- #include <PrintingManager.h>
- #endif
-
- #ifndef graphicsTypesIncludes
- #include "graphics types.h"
- #endif
-
- #ifndef fontTypesIncludes
- #include "font types.h"
- #endif
-
- #ifndef layoutTypesIncludes
- #include "layout types.h"
- #endif
-
- #define kDefaultSize 24
- #define kDefaultFace 0 /* no defined constant for plain text */
-
- #define kDefaultHeight 18
-
- #define kDefaultFont 0
- #define kDefaultFontName "\pMonaco"
-
- #define kDefaultStyle 0
-
- #define kGXEditFileVersion0 0x00010000
- #define kGXEditFileVersion 0x00010001
- #define kGXEditMagic 0xabcd1234
-
- #define kUndefinedStyle -1
- #define kUndefinedSize -1
- #define kUndefinedFont -1
-
- #define kPrintTopMargin (72 * 1.0)
- #define kPrintLeftMargin (72 * 1.0)
- #define kPrintRightMargin (72 * 1.0)
- #define kPrintBottomMargin (72 * 1.0)
-
- /* offset types for GetOffset routines */
-
- #define kPreviousOffset 0
- #define kVisualLeftOffset 1
- #define kVisualRightOffset 2
- #define kUpOffset 3
- #define kDownOffset 5
-
- typedef struct {
-
- gxStyle textStyle;
- gxFont textFont;
- short textSize;
- gxFontScript script;
- gxFontLanguage language;
- gxFontPlatform platform;
-
- short refCount; /* how many runs reference this style */
-
- } StyleRec, * StylePtr, ** StyleHan;
-
- typedef struct {
-
- short styleIndex; /* the gxStyle for this run */
- short paraOffset; /* offset in the para of first glyph */
-
- short numText; /* the amount of text in the run */
- void ** text; /* the text data */
-
- } NewRunRec, * NewRunPtr, ** NewRunHan;
-
- typedef struct {
-
- void * layout; /* the layout for the gxLine */
- gxPoint layoutPos;
- short height; /* height of this gxLine */
-
- Boolean dirty; /* this gxLine is dirty
- a) layout needs to be calculated -and/or-
- b) height is invalid
- */
-
- short ascent;
- short descent;
-
- short start; /* where this gxLine starts in the paragraph */
-
- short paraOffset; /* the paragraph offset of the first glyph */
- short numText; /* number of glyphs in this gxLine */
-
- Boolean reflow; /* the gxLine has to be reflowed */
-
- Boolean drawn; /* this gxLine has been drawn and is upto date */
- Boolean selected; /* the gxLine selection range is drawn and up to date */
- short startOffset; /* the start offset of the selection */
- short endOffset; /* the end offset of the selection */
-
- } LineRec, * LinePtr, ** LineHan;
-
- typedef struct {
-
- short height; /* paragraph height */
-
- Boolean dirty; /* one or more lines of the paragraph are dirty
- a) height of paragraph is invalid -and/or-
- b) start positions of lines are invalid
- */
-
- short start; /* where this paragraph starts in the document */
-
- short width; /* paragraph width */
-
- long docOffset; /* the document offset of the first glyph */
- short numText; /* number of glyphs in this paragraph */
-
- short numLines;
- LineHan lines; /* lines that make up the paragraph */
-
- short numRuns; /* the runs that make up the paragraph */
- NewRunHan runs;
-
- Boolean drawn; /* this paragraph has been drawn and parts are uptodate */
-
- Boolean reflow; /* this paragraph needs to be reflowed */
-
- gxLayoutOptions layoutOptions; /* the layout options for this paragraph */
-
- } ParaRec, * ParaPtr, ** ParaHan;
-
- typedef struct {
-
- long startDocOffset;
- long endDocOffset;
-
- Boolean endOfLine; /* the caret selection is at the end of a gxLine */
-
- short startParaIndex;
- short startParaOffset;
- short endParaIndex;
- short endParaOffset;
-
- } SelRec, * SelPtr, ** SelHan;
-
- typedef struct {
-
- long numText;
- short numRuns;
- NewRunHan runs;
-
- } ScrapRec, * ScrapPtr, ** ScrapHan;
-
- typedef struct {
-
- Boolean start;
-
- short numStyles;
- short ** styles;
-
- short numFonts;
- gxFont ** fonts;
-
- short size;
-
- } AttrRec, * AttrPtr, ** AttrHan;
-
- typedef struct {
-
- long magic; /* magic number for validity */
-
- long length; /* length of overall document */
-
- Boolean dirty; /* the document is dirty
- a) length is invalid
- b) paragraph starts are invalid
- */
-
- short lineWidth; /* width of a gxLine in the document */
- gxLayoutOptions currentLayoutOptions; /* the default layout options for new paragraphs */
-
- short numStyles; /* the styles that appear in the document */
- StyleHan styles;
-
- long numText; /* number of glyphs in the document */
-
- short numParagraphs;
- ParaHan paragraphs; /* paragraphs that make up the document */
-
- SelRec selection; /* the current selection */
-
- Boolean active; /* is the document active */
-
- Rect viewRect; /* the drawing area */
- short leftMargin; /* the left margin */
- short rightMargin; /* the right margin */
- short viewHeight; /* the height of the view area */
-
- long top; /* the top position in the current view area */
- long maxTop; /* maximum top position */
-
- short numCurrentStyles; /* the styles, size and gxFont of the current selection */
- short ** currentStyles;
-
- short currentSize;
-
- short numCurrentFonts;
- gxFont ** currentFonts;
-
- short emptyStyle; /* the gxStyle used when the selection is empty */
-
- gxViewPort docViewPort; /* view port for document */
- gxViewPort offscreenPort; /* offscreen view port */
- gxViewDevice offscreenDevice;
- gxViewGroup offscreenGroup;
- Ptr offscreenBytes;
- gxShape offscreenBitmap;
-
- long pageTop; /* the top page margin */
- long pageBottom; /* the bottom page margin */
- long pageLeft; /* the left page margin position */
- long pageRight; /* the right page margin position */
-
- ScrapRec scrap; /* the current document scrap */
-
- Boolean drawn; /* this document has been drawn and parts are up to date */
- short bottomClear; /* from this gxPoint to the bottom is clear */
-
- long currentTime; /* the time at the last idle call */
-
- GXEditUserErrorProc errorProc; /* user error posting routine */
- long * errorProcRef;
-
- GXEditError error;
- GXEditError stickyError;
-
- gxFontLanguage currentLanguage; /* language of all inserted text */
- gxFontScript currentScript; /* script of inserted text */
- gxFontPlatform currentPlatform;
-
- Boolean verticalText; /* the text be displyed vertically */
-
- short maxLineOffset; /* the maxium line offset the user has selected */
-
- } DocRec, * DocPtr, ** DocHan;
-
- extern void NewDoc(DocHan * doc, Rect * viewRect, gxViewPort docViewPort, short leftMargin, short rightMargin);
- extern void DisposeDoc(DocHan doc);
-
- extern void DocSetSelection(DocPtr dp, long selStart, long selEnd);
- extern long DocHitTest(DocPtr dp, Point pt);
-
- extern void DocClick(DocPtr dp, Point where, Boolean extend);
- extern void DocScroll(DocPtr dp, short dv);
- extern void DocSize(DocPtr dp, Rect * viewRect);
- extern long DocSetTop(DocPtr dp, long top);
- extern long DocGetTop(DocPtr dp);
- extern long DocGetMaxTop(DocPtr dp);
- extern long DocGetMaxTop(DocPtr dp);
- extern void DocKey(DocPtr dp, char key);
- extern void DocClear(DocPtr dp);
- extern void DocInsert(DocPtr dp, void * text, short numText);
-
- extern long DocHeight(DocPtr dp);
-
- extern void DocSetTextFonts(DocPtr dp, short numFonts, gxFont * srcFonts, gxFont * dstFonts);
- extern void DocGetTextFonts(DocPtr dp, short * numFonts, gxFont * fonts);
-
- extern void DocSetTextSize(DocPtr dp, short size);
- extern short DocGetTextSize(DocPtr dp);
-
- extern void DocSetFeatures(DocPtr dp, gxFont fontId, short numFeatureGroups,
- short * srcFeatureGroupSizes,
- gxRunFeature ** srcFeatureGroups,
- short * dstFeatureGroupSizes,
- gxRunFeature ** dstFeatureGroups);
- extern void DocGetFeatures(DocPtr dp, gxFont fontId, short * numFeatureGroupsPtr,
- short *** featureGroupSizesPtr,
- gxRunFeature **** featureGroupsPtr);
-
- extern void DocGetVariations(DocPtr dp, gxFont fontId, short * numInstancesPtr,
- short *** instanceSizesPtr, gxFontVariation **** instancesPtr);
- extern void DocSetVariations(DocPtr dp, gxFont fontId, short numVariations, gxFontVariation * variations);
-
- extern void DocGetSelectionStyles(DocPtr dp, short * numStyles, gxStyle * styles);
- extern void DocSetSelectionStyles(DocPtr dp, gxStyle * toStyles);
-
- extern void DocSave(DocPtr dp, short fRefNum);
- extern void DocOpen(DocHan * doc, Rect * viewRect, gxViewPort docViewPort, short fRefNum,
- short leftMargin, short rightMargin);
-
- extern void DocPrint(DocPtr dp, gxJob printJob);
-
- extern void DocCut(DocPtr dp);
- extern void DocCopy(DocPtr dp);
- extern void DocPaste(DocPtr dp);
-
- extern long DocGetScrapLen(DocPtr dp);
- extern long DocGetTextLen(DocPtr dp);
- extern long DocGetSelectionLen(DocPtr dp);
-
- extern void DocGetRunControls(DocPtr dp, gxRunControls * runControls, gxRunControls *mask);
- extern void DocSetRunControls(DocPtr dp, gxRunControls * runControls, gxRunControls *mask);
-
- extern void DocGetFontRunControls(DocPtr dp, gxFont fontID, gxRunControls * runControls, gxRunControls *mask);
-
- extern void DocGetLayoutOptions(DocPtr dp, gxLayoutOptions * options, gxLayoutOptions *mask);
- extern void DocSetLayoutOptions(DocPtr dp, gxLayoutOptions * options, gxLayoutOptions *mask);
-
- extern void DocGetJustification(DocPtr dp, Boolean *setting);
- extern void DocSetJustification(DocPtr dp, Boolean setting);
-
- extern Boolean DocIdle(DocPtr dp);
- extern void DocUpdate(DocPtr dp, gxRectangle * updateRect);
-
- extern void DocSetMaxTop(DocPtr dp);
-
- extern void DocProof(DocPtr dp, GXEditProofPtr proof);
-
- extern void DocActivate(DocPtr dp, Boolean activate);
-
- extern void DocSetEncoding(DocPtr dp, gxFontPlatform platform, gxFontScript script, gxFontLanguage language);
-
- extern void DocSetVerticalText(DocPtr dp, Boolean enable);
- extern void DocGetVerticalText(DocPtr dp, Boolean * enable);
-
- extern void DocGetSelectionEncoding(DocPtr dp, gxFontPlatform * platform,
- gxFontScript * script, gxFontLanguage * language);
- extern void DocSetSelectionEncoding(DocPtr dp, gxFontPlatform platform,
- gxFontScript script, gxFontLanguage language);
-
- Boolean DocReflow(DocPtr dp);
-
- #endif
-
-
-